import time

from page_objects import PageObject, PageElement
from pages.welcome_page_5i5j import WelcomePage


class BuildHousePage(WelcomePage):
    """新建房源页面"""
    build_house_button = PageElement(link_text="+新建房源")
    built_select_button = PageElement(tag_name='b')
    built_search_input = PageElement(class_name='select2-input')
    """只适用搜索结果只有一个时定位"""
    built_search_result = PageElement(class_name='select2-user-result')   #楼盘搜索
    building_block = PageElement(css="body.page-header-fixed.page-sidebar-closed:nth-child(2) div.page-container:nth-child(40) div.page-content:nth-child(14) div.container-fluid.new:nth-child(1) div.tab-pane div.tabbable.tabbable-custom:nth-child(2) div.tab-content div.tab-pane.active:nth-child(1) div.cz-main:nth-child(2) div.cz-main-in div.tx.row-fluid.bd-n:nth-child(1) div.row-flion:nth-child(6) div.layui-form.span9 div.layui-form-select div.layui-select-title > input.layui-input")
    building_block_choice = PageElement(xpath="//dd[3]")
    time.sleep(2)
    unit_select = PageElement(id_='unitSelect')
    unit_select_choice = PageElement(xpath="//select[@id='unitSelect']//option[contains(text(),'0')]")
    floor_select = PageElement(css="body.page-header-fixed.page-sidebar-closed:nth-child(2) div.page-container:nth-child(40) div.page-content:nth-child(14) div.container-fluid.new:nth-child(1) div.tab-pane div.tabbable.tabbable-custom:nth-child(2) div.tab-content div.tab-pane.active:nth-child(1) div.cz-main:nth-child(2) div.cz-main-in div.tx.row-fluid.bd-n:nth-child(1) div.row-flion:nth-child(8) div.layui-form.span9 div.layui-form-select div.layui-select-title > input.layui-input")
    floor_select_choice = PageElement(xpath="//div[contains(@class,'layui-form span9')]//dd[2]")
    room_select = PageElement(id_='roomSelect')
    room_select_choice = PageElement(xpath="//option[contains(text(),'101')]")
    next_button = PageElement(id_="//option[contains(text(),'101')]")

